import type {
  DepartData,
  OrderDetail,
  OrderId,
  OrderParams,
  OrderPreData,
  OrderPreParams,
} from "@/types/consult"
import type { EvaluateDocParams, EvaluateId } from "@/types/room"
import { request } from "@/utils/http"

/**
 * 医生科室列表
 */
export const getDepartmentListApi = () => {
  return request.get<null, DepartData[]>("/dep/all")
}

/**
 * 问诊-支付页面-计算就诊信息和抵扣信息
 * @param params
 * @returns
 */
export const getConsultOrderPreApi = (params: OrderPreParams) => {
  return request.get<null, OrderPreData>("/patient/consult/order/pre", {
    params,
  })
}

/**
 * 问诊-保存/修改问诊订单
 * @param data
 * @returns
 */
export const createInquiryOrderApi = (data: OrderParams) => {
  return request.post<null, OrderId>("/patient/consult/order", data)
}

/**
 * 问诊-查询订单详情信息-找医生、极速问诊和开药问诊
 * @param orderId
 * @returns
 */
export const getOrderDetailApi = (orderId: string) => {
  return request.get<null, OrderDetail>("/patient/consult/order/detail", {
    params: { orderId },
  })
}

/**
 * 问诊-订单-评价医生
 * @param data
 * @returns
 */
export const evaluateDoctorApi = (data: EvaluateDocParams) => {
  return request.post<null, EvaluateId>("/patient/order/evaluate", data)
}
